Dynomotion

Group: DynoMotion Message: 14958 From: kflop@mailinator.com Date: 8/22/2017
Subject: M code and C programs

Hello,


I am trying to execute a C programm with a M gcode. Is there a way to test in the C programm which M code has been used?


For example:

I execute a C program with M100. Can i find out in the C program that M100 has been used?





Thanks. And keep up the good work. 

Group: DynoMotion Message: 14959 From: Tom Kerekes Date: 8/22/2017
Subject: Re: M code and C programs

If no P Q R parameters are specified the MCode number is placed as an integer into the KFLOP persist variable specified by the Var setting before the C program is executed.

Regards

TK


On 8/22/2017 3:11 AM, kflop@... [DynoMotion] wrote:
 

Hello,


I am trying to execute a C programm with a M gcode. Is there a way to test in the C programm which M code has been used?


For example:

I execute a C program with M100. Can i find out in the C program that M100 has been used?





Thanks. And keep up the good work. 


Group: DynoMotion Message: 14964 From: kflop@mailinator.com Date: 8/24/2017
Subject: Re: M code and C programs
Thank. I have now been able to create just 1 C program for M3, M4 and M5.  It runs in thread 2 and takes Var 1. In the C program I do a switch statement something like this:

Switch persist.Userdata[1]
{
case  3
Jog CW
Laststate=1
break

case 4
Jog CWW
Laststate=-1
break

case 5
Stop spindle
Laststate
break
}


it works great.

I  would like also to add a case block for the S, but the gcode S only transfers the desired speed to variable 113.
Is there a way to tell in a C programm that the S had been used? Is it possible to modify some .h file, to let the S also put a certain int in a given var?

I try to create just 1 C file for all the above.

Thanks.